<?php

namespace App\Models\Cms;

use App\Helpers\SelfEncrypt;
use App\Models\BaseModel;

class ArticleModel extends BaseModel
{
    protected $table = 'cms_article';

    public $dateFormat = 'U';

    protected $dates = [];


    public function setContentAttribute($val)
    {
        $this->attributes['content'] = SelfEncrypt::encrypt($val);
    }

    public function getContentAttribute($val)
    {
        return SelfEncrypt::decrypt($val);
    }

    public function articleCat(){

        return $this->belongsTo('App\Models\Cms\ArticleCatModel','cat_id','id');
    }
}
